#ifndef DBS_H
#define DBS_H

#include <vector>
#include <utility>
#include <string>
#include "article.h"
#include "dbinterface.h"
#include "newsgroup.h"

class dbsave:public dbinterface{
public:
	dbsave();
	
	std::pair<int, std::string> findgroupname(std::string name);	
	std::pair<int, std::string> findgroupid(int id);
	std::vector<std::pair<int, std::string>> listnewsgroups() override;
	bool createnewsgroup(std::string name) override;
	bool deletenewsgroup(int groupid) override;
	std::pair<std::vector<std::pair<int, std::string>>, int> listarticles(int id) override;
	bool createarticle(int groupid, std::string title, std::string author, std::string text) override;
	int deletearticle(int groupid, int articleid) override;
	std::pair<int, article> getarticle(int groupid, int articleid) override;
private:
	std::unordered_map<int, newsgroup> newsgroups;
	int nextgroupid;
	
};
#endif
